Safe managed pressure drilling (MPD) requires a hydraulic model predicting the pressure distribution in a well. The better the model, the more precisely the pressure distribution in the well can be predicted. This hydraulic model should preferably have real-time input of operation parameters, such as top drive speed, weight on bit, pump speed, etc. In addition, actual parameters of the circulated fluid, such as viscosity, density, and compressibility, need to be established, preferably also in real-time. Fluid viscosity and density are both usually measured in the field, e.g. on a drilling rig, and thus are known to drilling operators. Fluid compressibility, on the other hand, is not measured in the field, and is therefore not known by drilling operators, at least not in real-time. Today, fluid compressibility may be found from look-up tables obtained from measurements in remote lab facilities. In order to predict the pressure distribution in the well with a satisfying accuracy, there is a need for a more accurate measurement of compressibility as input to the hydraulic model. The fluid discussed below is drilling mud, but the embodiments disclosed herein have broader application and are applicable to fluids in general, such that the disclosure herein therefore is not restricted to drilling mud.